package com.golddaymicromall.util;

import java.io.UnsupportedEncodingException;
import java.util.Map;

/**
 * 王立强
 * Created by Administrator on 2016/1/18 0018.
 */
public class ServerConfig {

    public final static String SERVER = "http://122.5.13.154/ROP/api";
    public final static String url = "http://122.5.13.154/ROP/";
    public final static String QRURL = "http://122.5.13.154/ROP/customercreate";
    public final static String COPYRIGHT = "http://122.5.13.154/ROP/banquanxinxi";
    public final static String LICENSE = "http://122.5.13.154/ROP/ruanjianxieyi";
    public final static String FILEDOWNLOAD = "http://122.5.13.154/ROP/Files";

    public final static String zhifubaourl = "http://122.5.13.154/ROP/OnlineRemittance/zfbzhifu";

//    public final static String SERVER = "http://172.17.20.24:8080/rop/api";
//    public final static String url = "http://172.17.20.24:8080/rop/";
//    public final static String QRURL = "http://172.17.20.24:8080/rop/customercreate";
//    public final static String COPYRIGHT = "http://172.17.20.24:8080/rop/banquanxinxi";
//    public final static String LICENSE = "http://172.17.20.24:8080/rop/ruanjianxieyi";
//    public final static String FILEDOWNLOAD = "http://122.5.13.154/ROP/Files";

//    public final static String SERVER = "http://172.17.20.24:8080/ROP/api";
//    public final static String url = "http://172.17.20.24:8080/ROP/";
//    public final static String QRURL = "http://172.17.20.24:8080/ROP/customercreate";
//    public final static String COPYRIGHT = "http://172.17.20.24:8080/ROP/banquanxinxi";
//    public final static String LICENSE = "http://172.17.20.24:8080/ROP/ruanjianxieyi";
//    public final static String FILEDOWNLOAD = "http://122.5.13.154/ROP/Files";

//    public final static String SERVER = "http://172.17.20.5:8080/ROP/api";
//    public final static String url = "http://172.17.20.5:8080/ROP/";
//    public final static String QRURL = "http://172.17.20.5:8080/ROP/customercreate";
//    public final static String COPYRIGHT = "http://172.17.20.5:8080/ROP/banquanxinxi";
//    public final static String LICENSE = "http://172.17.20.5:8080/ROP/ruanjianxieyi";
//    public final static String FILEDOWNLOAD = "http://122.5.13.154/ROP/Files";

    public static String getUrl() {
        return url;
    }

    /**
     * 将map转换成url
     *
     * @param map
     * @return
     */
    public static String getUrlParamsByMap(Map<String, Object> map) throws UnsupportedEncodingException {
        if (map == null) {
            return "";
        }
        StringBuffer sb = new StringBuffer();
        sb.append("?");
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            sb.append(entry.getKey() + "=" + entry.getValue());
            sb.append("&");
        }
        String s = sb.toString();
        if (s.endsWith("&")) {
            s = org.apache.commons.lang.StringUtils.substringBeforeLast(s, "&");
        }
        return s;
    }
}
